package com.fyy;

import com.fyy.absfactory.AbstractFactory;
import com.fyy.absfactory.FactoryCreate;
import com.fyy.absfactory.color.Color;
import com.fyy.absfactory.shape.Shape;

/**
 * @Author fyy
 * @Description
 * @Date 2020/7/23 9:46
 */
public class AbstractFactoryTest {

    public static void main(String[] args) {

        AbstractFactory shapeFactory = FactoryCreate.getFactory("shape");
        Shape shape1 = shapeFactory.getShape("RECTANGLE");
        shape1.draw();
        Shape shape2 = shapeFactory.getShape("SQUARE");
        shape2.draw();
        Shape shape3 = shapeFactory.getShape("CIRCLE");
        shape3.draw();

        AbstractFactory colorFactory = FactoryCreate.getFactory("color");
        Color color1 = colorFactory.getColor("RED");
        color1.fill();
        Color color2 = colorFactory.getColor("GREE");
        color2.fill();
        Color color3 = colorFactory.getColor("BLUE");
        color3.fill();

    }

}
